<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Proxy内置方法</title>
</head>
<body>
<script>
    function isPrime(number){
        if(number<2) {
            return false
        }
        for(let i=2;i<number;i++){
            if(number%i===0){
                return false
            }
        }
        return true
    }
    isPrime = new Proxy(isPrime,{
        apply(target, thisArg, argArray) {
            console.time('isPrime');
            const result = target.apply(thisArg,argArray);
            console.timeEnd('isPrime');
            return result
        }
    });
    isPrime(1299827);
</script>
</body>
</html>
